package com.moon.repository;

import com.moon.japentity.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface StudentRepository extends JpaRepository<Student,Integer> {
    public List<Student> findByDepartment(String dept);
    public List<Student> findByDepartmentAndSex(String dept,String sex);

    List<Student> findByIdGreaterThan(int i);

    @Query("select s from Student s where s.department=:dept")
    public List<Student> findBySomeCond(@Param("dept") String dept);

    @Query(value="select * from student s where s.department=:dept",nativeQuery=true)
    public List<Student> findBySomeCond1(@Param("dept") String dept);
}
